<% content_for :thredded_page_title, t('thredded.topics.search.page_title') %>
<% content_for :thredded_page_id, 'thredded--topic-search-results' %>
<% content_for :thredded_breadcrumbs, render('thredded/shared/breadcrumbs') %>

<%= thredded_page do %>
  <% if @topics.present? %>
    <p class="thredded--alert thredded--alert-success">
      <% if messageboard_or_nil %>
        <%= t 'thredded.topics.search.results_in_messageboard_message_html',
              query: @query, messageboard: messageboard.name %>
        <br>
        <a href="<%= messageboards_search_path(q: @query) %>">
          <%= t('thredded.topics.search.search_in_all_messageboards_btn') -%>
        </a>
      <% else %>
        <%= t 'thredded.topics.search.results_message_html', query: @query %>
      <% end %>
    </p>
    <section class="thredded--main-section thredded--topics">
      <%= render @topics %>
    </section>
    <footer class="thredded--pagination-bottom">
      <%= paginate @topics %>
    </footer>
  <% else %>
    <p class="thredded--alert thredded--alert-danger">
      <% if messageboard_or_nil %>
        <%= t 'thredded.topics.search.no_results_in_messageboard_message_html',
              query: @query, messageboard: messageboard.name -%>
        <br>
        <a href="<%= messageboards_search_path(q: @query) %>">
          <%= t('thredded.topics.search.search_in_all_messageboards_btn') -%>
        </a>
      <% else %>
        <%= t 'thredded.topics.search.no_results_message_html', query: @query %>
      <% end %>
    </p>
  <% end %>
<% end %>
